package org.merak.core.model;

@SuppressWarnings("serial")
public class ProgrammaticException extends RuntimeException {

	//~ Constructors /////////////////////////////////////////////////////////////
	//****************************************************************************
    public ProgrammaticException(String s) {
        super(s);
    }
	//****************************************************************************
    public ProgrammaticException(String s, Throwable cause) {
        super(s,cause);
    }
	//****************************************************************************
    public ProgrammaticException(Throwable cause) {
        super(cause);
    }
	//~ Methods //////////////////////////////////////////////////////////////////
	//****************************************************************************
    public final boolean hasCause() {
    	return super.getCause() != null;
    }
	//****************************************************************************
    public final Throwable getPrimaryCause() {
    	return getPrimaryCause(this);
    }
	//****************************************************************************
    public static Throwable getPrimaryCause(Throwable ex) {

    	Throwable cause = ex;
       	while (cause.getCause() != null) {
       		cause = cause.getCause();
       	}
    	return cause;

    }
	//****************************************************************************

}
